-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(compiler-cli): emit correct css string escape sequences #22776
Conversation
Works around an issue with TypeScript 2.6 and 2.7 that causes the tranformer emit to emit incorrect escapes for css string literals. Fixes: angular#22774
You can preview 9942c35 at https://pr22776-9942c35.ngbuilds.io/. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congrats on the terrible hack :)
You can preview e6b004a at https://pr22776-e6b004a.ngbuilds.io/. |
You can preview 752c819 at https://pr22776-752c819.ngbuilds.io/. |
You can preview e48718c at https://pr22776-e48718c.ngbuilds.io/. |
@@ -150,13 +150,28 @@ function firstAfter<T>(a: T[], predicate: (value: T) => boolean) { | |||
// NodeEmitterVisitor | |||
type RecordedNode<T extends ts.Node = ts.Node> = (T & { __recorded: any; }) | null; | |||
|
|||
function escapeLiteral(value: string): string { | |||
return value.replace(/(\"|\\)/g, '\\$1').replace(/(\n)|(\r)/g, function(v, n, r) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would .replace(\n).replace(\r)
be more readable ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or .replace(/(\n|\r)/)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure but slower.
…22776) Works around an issue with TypeScript 2.6 and 2.7 that causes the tranformer emit to emit incorrect escapes for css string literals. Fixes: angular#22774 PR Close angular#22776
- Upgrade example app to `Angular` v6.1 with `TypeScript` v2.9. - Upgrade `jest` and `jest-preset-angular` to reflect the latest support of `jest` v23. - Upgrade snapshot of `AppComponent` due to the [change](angular/angular#22776) in `Angular` v6.1. - Upgrade other dependencies.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Works around an issue with TypeScript 2.6 and 2.7 that causes
the tranformer emit to emit incorrect escapes for css string
literals.
Fixes: #22774
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #22774
What is the new behavior?
Bypasses TypeScript incorrect string escaping to produce the correct
.js
file.Does this PR introduce a breaking change?